package com.optimus.utils;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.optimus.db.DataBaseManager;

public class SpringUtils
{
	private static ApplicationContext context;

	private static ApplicationContext getContext()
	{
		if (context == null)
		{
			context = new ClassPathXmlApplicationContext("beans.xml");
		}

		return context;
	}

	public static Object getBean(String name)
	{
		return getContext().getBean(name);
	}

	public static DataBaseManager getDatabaseManager()
	{
		return (DataBaseManager) getBean("dataBaseManager");
	}
}
